package com.example.cpms.mapper;


import com.example.cpms.entity.Building;
import com.example.cpms.entity.Plant;
import org.apache.ibatis.annotations.*;

import java.util.List;
/**
 * @author 乔
 */
@Mapper
public interface PlantMapper {
//    根据id删除植物
    @Delete("delete from plant where id = #{id}")
    void deleteById(int id);

    //新增植物
    @Insert("insert into plant(name,species,number,waterfrequency) values(#{name},#{species},#{number},#{waterfrequency})")
    void insert(Plant plant);

    public List<Plant> list(@Param("name") String name);

    @Update("update plant set name = #{name},  species= #{species}, number = #{number}, waterfrequency = #{waterfrequency} where id = #{id} ")
    void update(Plant plant);

    //查询植物
    @Select("select id,name,species,number,waterfrequency from plant")
    List<Plant> findAll();
}
